﻿<!DOCTYPE html>
<html  onselectstart="return false">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>用户注册</title>
    <link rel="icon" href="images/favicon.ico" type="image/x-icon" />
    <link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon"/>
    <link type="text/css" rel="stylesheet" href="css/willon.css"/>
    <link type="text/css" rel="stylesheet" href="css/login.css"/>
</head>
<body>
    <div class="login-view">
        <div class="login-logo">
            <img src="images/logo.jpg" alt="logo加载失败">
        </div>
        <div class="login-input-group">
            <input type="text" id="cellphone" class="login-input" placeholder="手机号"/>
            <span class="tips"></span>
        </div>
        <div class="login-input-group">
            <input type="text" id="nickname" class="login-input" placeholder="昵称"/>
            <span class="tips"></span>
        </div>
        <div class="login-input-group">
            <input type="password" id="password1" class="login-input" placeholder="密码"/>
            <span class="tips"></span>
        </div>
        <div class="login-input-group">
            <input type="password" id="password2" class="login-input" placeholder="再次输入密码"/>
            <span class="tips"></span>
        </div>
        <div class="login-input-group">
            <input type="text" id="verify" class="login-input" placeholder="验证码"/>
            <span class="tips" style="top:28px;right:88px;"></span>
            <div class="verifyCode"><img src="images/verifyCode.jpg" alt="验证码加载失败"></div>
        </div>
        <div class="login-input-group">
            <div id="sign_in"class="login-btn">注册</div>
            <span class="tips"></span>
        </div>
        <div class="login-tips" style="text-align:center;color:#c0c0c0">
                <span>点击“注册”按钮，即代表您同意</span><a href="#" style="color:#3da6da" title="查看该协议">《我们公司的用户协议》</a>
                <div class="login-tips-other" style="left:37%">版权&copyWillon</div>
        </div>
    </div>
    <canvas id="canvas"></canvas>
</body>
<script src="js/canvas.js"></script>
<script src="js/willon_js_baseFrame.js"></script>
<script src="js/willon_checkForm_entity.js"></script>
<script>
    (function(){
        var cellphone = $('#cellphone'),
            nickname = $('#nickname'),
            password1 = $('#password1'),
            password2 = $('#password2'),
            verifyCode = $('#verify'),
            sign_in = $('#sign_in'),
            flag = {};
        bindEvent(cellphone,'blur',function(){
            flag.cellphone = checkForm.check('cellphone',cellphone.nextElementSibling,cellphone.value).end();
        });
        bindEvent(nickname,'blur',function(){
            flag.uername = checkForm.check('userName',nickname.nextElementSibling,nickname.value).end();
        });
        bindEvent(password1,'blur',function(){
            flag.password1 = checkForm.check('password',password1.nextElementSibling,password1.value).end();
        });
        bindEvent(password2,'blur',function(){
            if(password1.value!==password2.value){
                password2.nextElementSibling.innerHTML = '密码不一致';
                flag.password2 = false;
            }else{
                flag.password2 = true;
                hideTips(password2.nextElementSibling);
            }
                
        });
        // bindEvent(email,'blur',function(){
        //     flag.email = checkForm.check('email',email.nextElementSibling,email.value).end();
        // });
        bindEvent(verifyCode,'keyup',function(){
            flag.verifyCode = false;
            if(verifyCode.value.length >= 4){
                if(verifyCode.value.toLowerCase() ==='3aed'){
                    flag.verifyCode = true;
                    hideTips(verifyCode.nextElementSibling);
                }else
                    verifyCode.nextElementSibling.innerHTML = "验证码错误";
            }
        });
        bindEvent(sign_in,'click',function(){//最后再检测一次是否有错
            var canSign = false;  
            for(var attt in flag){
                if(!flag[attr]){
                    canSign = false;
                    break;
                }else{
                    canSign = true;
                }
            }
            if(canSign){
                alert('注册成功');
            }else{
                alert('注册失败');
            }
        });
    })();
    

</script>
</html>